﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace FunasrSTT.Translate.Converters;

/// <summary>
/// 计算百分比之和.
/// </summary>
public class PercentSumConverter : IValueConverter
{
    /// <inheritdoc />
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is IEnumerable<double> values)
        {
            return values.Sum();
        }

        return 0F;
    }

    /// <inheritdoc />
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return 0F;
    }
}
